#pragma once

#include "Foundation.h"

class Room;

class Reservation : public Num_element {
private:
	friend class Hotel;
	friend class Room;
	
public:
				Reservation(ifstream &file, int arrDate);
				Reservation(Date arrDate);
				~Reservation();
	void 		display();		
	void 		WriteToFile(ofstream &file);
	bool 		IncludesDate(Date date);	// (arrival < date < departure)?
	bool 		isCheckedIn();
	string* 	getCustomerName();
	int			numOfCustomers();
	void		printBills();
	void 		addBill(string desc, float sum);

private:
	enum BedStatus {
		BED_UNAVAILABLE,
		BED_AVAILABLE,
		BED_TAKEN
	};

	List		*bills;						// FIFO
	Date		arrivalDate;				// == Num_element::number
	Date		departureDate;
	int			lengthOfStay;
	float		*dailyPrices;
	BedStatus 	bedStatus;
	bool 		checkedIn;
	int 		numResidents;
	string	 	*residentNames;
	Room 		*room;
	
	void 		setArrivalDate(Date arr);			// Set a new arrival date
	void 		setDepartureDate(Date dep);			// Set a new departure date
	void		updateDailyPrices(int newLen);		// Update prices 
	void		udpateDailyPricesOnDepartureChange(int newLen);
	void 		updateDailyPricesOnArrivalChange(int newLen, Date newArr);
	void 		readResidents();			// Performed at booking
	void 		readAdditionalResidents();	// Performed at check-in
};

